

#ifndef UD_DBLEAD_H
#define UD_DBLEAD_H 1

#include "zdbmain.h"
#include "zdbcurve.h"
#include "zgescl3d.h"
#include "zgepnt2d.h"
#include "zgeplane.h"

#pragma pack(push, 8)

class UcDbLeader: public  UcDbCurve
{
public:
    UcDbLeader();
    ~UcDbLeader();
    UCDB_DECLARE_MEMBERS(UcDbLeader);
    DBCURVE_METHODS

    virtual void              setPlane          (const UcGePlane&);
    virtual UcGeVector3d      normal            () const;

    virtual  int numVertices() const;
    virtual  ZSoft::Boolean appendVertex(const UcGePoint3d&);
    virtual  void              removeLastVertex  ();
    virtual  UcGePoint3d firstVertex() const;
    virtual  UcGePoint3d lastVertex() const;
    virtual  UcGePoint3d vertexAt(int) const;
    virtual  ZSoft::Boolean setVertexAt(int, const UcGePoint3d&);

    virtual ZSoft::Boolean    hasArrowHead      () const;
    virtual void              enableArrowHead   ();
    virtual void              disableArrowHead  ();
    virtual ZSoft::Boolean    hasHookLine       () const;
    
    virtual void              setToSplineLeader ();
    virtual void              setToStraightLeader();
    virtual ZSoft::Boolean    isSplined         () const;
    
    virtual UcDbHardPointerId dimensionStyle    () const;
    virtual void              setDimensionStyle (const UcDbHardPointerId&);
    
    Ucad::ErrorStatus   getDimstyleData(UcDbDimStyleTableRecord*& pRecord) const;
    Ucad::ErrorStatus   setDimstyleData(UcDbDimStyleTableRecord* pNewData);
    Ucad::ErrorStatus   setDimstyleData(UcDbObjectId newDataId);

    virtual Ucad::ErrorStatus attachAnnotation  (const UcDbObjectId& annoId);
    virtual Ucad::ErrorStatus detachAnnotation  ();
    virtual UcDbObjectId      annotationObjId   () const;
    virtual Ucad::ErrorStatus evaluateLeader    ();

    virtual UcGeVector3d      annotationOffset   () const;
    virtual Ucad::ErrorStatus setAnnotationOffset(const UcGeVector3d& offset);

    enum AnnoType { 
        kMText = 0,
        kFcf,
        kBlockRef,
        kNoAnno 
    };
    AnnoType annoType()   const;
    double   annoHeight() const;
    double   annoWidth()  const;

    virtual  Ucad::ErrorStatus intersectWith    (const UcDbEntity*,
                                                 UcDb::Intersect,
                                                 UcGePoint3dArray&,
                                                 ZSoft::GsMarker thisGsMarker = 0,
                                                 ZSoft::GsMarker otherGsMarker = 0) const;
    virtual  Ucad::ErrorStatus intersectWith    (const UcDbEntity*,
                                                 UcDb::Intersect,
                                                 const UcGePlane& projPlane,
                                                 UcGePoint3dArray&,
                                                 ZSoft::GsMarker thisGsMarker = 0,
                                                 ZSoft::GsMarker otherGsMarker = 0) const;

    virtual Ucad::ErrorStatus explode           (UcDbVoidPtrArray& entitySet) const;

    virtual double           dimasz   () const;
    virtual UcCmColor        dimclrd  () const;
    virtual double           dimgap   () const;
    virtual UcDb::LineWeight dimlwd   () const;
    virtual UcDbObjectId     dimldrblk() const;
    virtual bool             dimsah   () const;
    virtual double           dimscale () const;
    virtual int              dimtad   () const;
    virtual UcDbObjectId     dimtxsty () const;
    virtual double           dimtxt   () const;

    virtual Ucad::ErrorStatus setDimasz   (double         val);
    virtual Ucad::ErrorStatus setDimclrd  (UcCmColor&     val);
    virtual Ucad::ErrorStatus setDimgap   (double         val);
    virtual Ucad::ErrorStatus setDimldrblk(UcDbObjectId   val);
    virtual Ucad::ErrorStatus setDimldrblk(const ZTCHAR *  val);
    virtual Ucad::ErrorStatus setDimlwd   (UcDb::LineWeight v);  
    virtual Ucad::ErrorStatus setDimsah   (bool           val);
    virtual Ucad::ErrorStatus setDimscale (double         val);
    virtual Ucad::ErrorStatus setDimtad   (int            val);
    virtual Ucad::ErrorStatus setDimtxsty (UcDbObjectId   val);
    virtual Ucad::ErrorStatus setDimtxt   (double         val);

    virtual void              modified          (const UcDbObject*);
    virtual void              erased            (const UcDbObject*,
                                                 ZSoft::Boolean = ZSoft::kTrue);
    virtual void              goodbye           (const UcDbObject*);
    virtual void              copied            (const UcDbObject*,
                                                 const UcDbObject*);

    virtual Ucad::ErrorStatus   getClassID(CLSID* pClsid) const;

    virtual void              setDimVars        ();
    virtual Ucad::ErrorStatus setColorIndex     (ZSoft::UInt16,
                                 ZSoft::Boolean doSubents = ZSoft::kTrue);

};

inline ZSoft::Boolean UcDbLeader::isClosed() const
{
    return ZSoft::kFalse;
}

inline ZSoft::Boolean UcDbLeader::isPeriodic() const
{
    return ZSoft::kFalse;
}

inline ZSoft::Boolean UcDbLeader::isPlanar() const
{
    return ZSoft::kTrue;
}

inline Ucad::ErrorStatus UcDbLeader::getStartParam(double& param) const
{
    param = 0.0;
    return Ucad::eOk;
}

inline Ucad::ErrorStatus UcDbLeader::getOrthoProjectedCurve(const UcGePlane&,
                                                UcDbCurve*& ) const
{
    return Ucad::eNotApplicable;
}

inline Ucad::ErrorStatus UcDbLeader::getProjectedCurve(const UcGePlane&,
                                                const UcGeVector3d& projDir,
                                                UcDbCurve*& projCrv) const
{
    return Ucad::eNotApplicable;
}

inline Ucad::ErrorStatus UcDbLeader::getOffsetCurves(double offsetDist,
                                        UcDbVoidPtrArray& offsetCurves) const
{
    return Ucad::eNotApplicable;
}

inline Ucad::ErrorStatus UcDbLeader::getSecondDeriv (double param,
                                        UcGeVector3d& secDeriv) const
{
    return Ucad::eNotApplicable;
}

inline Ucad::ErrorStatus UcDbLeader::getSecondDeriv (const UcGePoint3d&,
                                UcGeVector3d& secDeriv) const
{
    return Ucad::eNotApplicable;
}

inline Ucad::ErrorStatus UcDbLeader::getSplitCurves (const UcGeDoubleArray& params,
                                UcDbVoidPtrArray& curveSegments) const
{
    return Ucad::eNotApplicable;
}

inline Ucad::ErrorStatus UcDbLeader::getSplitCurves (const UcGePoint3dArray& points,
                                UcDbVoidPtrArray& curveSegments) const
{
    return Ucad::eNotApplicable;
}

inline Ucad::ErrorStatus UcDbLeader::extend(double)
{
    return Ucad::eNotApplicable;
}

inline Ucad::ErrorStatus UcDbLeader::extend(ZSoft::Boolean, const UcGePoint3d&)
{
    return Ucad::eNotApplicable;
}

inline Ucad::ErrorStatus UcDbLeader::getArea(double&) const
{
    return Ucad::eNotApplicable;
}

#pragma pack(pop)

#endif

